package com.ajx.platform.buildingmronitor.utils;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.IOException;

public class FileUtil {
private static Logger logger = LoggerFactory.getLogger(FileUtil.class);

    public static File createFile(String path,String filename) {
        File file=new File(path,filename);
        if (!file.getParentFile().exists()) {// 目录不存在则创建新目录
            file.getParentFile().mkdirs();// 新建文件夹
        }
        if(file.exists()){
            logger.info("文件已存在!");
            logger.info(""+file.length());
        }else{
            try{
                file.createNewFile();
            }catch(IOException e){
                logger.info("文件创建失败");
            }
        }
        return file;
    }
}